package cn.myjerry.sort.col;

public class Worker implements java.lang.Comparable<Worker> {
	private final String type;
	private final double salary;
	public Worker() {
		this.type = null;
		this.salary = 0;
	}
	public Worker(String type, double salary) {
		super();
		this.type = type;
		this.salary = salary;
	}
	/**
	 * @return the type
	 */
	public String getType() {
		return type;
	}
	/**
	 * @return the salary
	 */
	public double getSalary() {
		return salary;
	}
	
	@Override
	public int compareTo(Worker o) {
		return this.salary>o.salary?1:(this.salary==o.salary?0:-1);
	}
	
	@Override
	public String toString() {
		return "工种："+this.type+"，工资："+this.salary+"\n";
	}
	
}
